﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameManager : MonoBehaviour
{

	public static Dictionary<string, object> cardDict, enemyDict, levelDict;
	public static int currentLevel = 10;
	public static DataSaveModule dataSave;
	public static GameState gameState;

	public static void LoadSaveData ()
	{
		string json = PlayerPrefs.GetString ("Data", "");
		if (json == "") {
			dataSave = new DataSaveModule ();
			dataSave.coin = 0;
			dataSave.atkAdd = 0;
			dataSave.hpAdd = 0;
			dataSave.levelMax = 1;
			dataSave.isMusicOn = true;
			dataSave.isSoundOn = true;
			SaveData ();
		} else {
			dataSave = JsonUtility.FromJson<DataSaveModule> (json);
		}
	}

	public static void SaveData ()
	{
		string json = JsonUtility.ToJson (dataSave);
		PlayerPrefs.SetString ("Data", json);
		PlayerPrefs.Save ();
	}
}

[System.Serializable]
public enum GameState
{
	PLAYING,
	PAUSING,
	WIN,
	LOSE,
	SELECT_LEVEL,
	SHOPPING,
	MENU,
	CHANGING_ENEMY
}